package com.example.springboot.entity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.sql.Date;

@Data
public class UserEntity {
    private Integer id;
    private String username;
    private String password;
    private String nickname;
    private String email;
    private String phone;
    private Date createTime;
    private Date updateTime;
    private String avatar;
    private Integer allViews;
    private Integer articleNum;
    private Integer fensNum;
    private String ipAddress;
    private String signature;
    private String birthday;
    private String openId;
    @JsonCreator
    public UserEntity(@JsonProperty("id") Integer id,
                      @JsonProperty("username") String username,
                      @JsonProperty("password") String password,
                      @JsonProperty("nickname") String nickname,
                      @JsonProperty("email") String email,
                      @JsonProperty("phone") String phone,
                      @JsonProperty("createTime") Date createTime,
                      @JsonProperty("updateTime") Date updateTime,
                      @JsonProperty("avatar") String avatar,
                      @JsonProperty("allViews") Integer allViews,
                      @JsonProperty("articleNum") Integer articleNum,
                      @JsonProperty("fensNum") Integer fensNum,
                      @JsonProperty("ipAddress") String ipAddress,
                      @JsonProperty("signature") String signature,
                      @JsonProperty("birthday") String birthday
                      ,@JsonProperty("openId") String openId
                      ) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.nickname = nickname;
        this.email = email;
        this.phone = phone;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.avatar = avatar;
        this.allViews = allViews;
        this.articleNum = articleNum;
        this.fensNum = fensNum;
        this.ipAddress = ipAddress;
        this.signature = signature;
        this.birthday = birthday;
        this.openId = openId;
    }

    public UserEntity(String username) {
        this.username = username;
    }
}
